1 | import lottie from 'lottie-web/build/player/lottie_light';
|
2 | import React, { memo, forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
3 | import equal from 'fast-deep-equal/es6/react';
|
4 | import clone from 'rfdc/default';
|
5 |
|
6 | function _extends() {
|
7 | _extends = Object.assign || function (target) {
|
8 | for (var i = 1; i < arguments.length; i++) {
|
9 | var source = arguments[i];
|
10 |
|
11 | for (var key in source) {
|
12 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
13 | target[key] = source[key];
|
14 | }
|
15 | }
|
16 | }
|
17 |
|
18 | return target;
|
19 | };
|
20 |
|
21 | return _extends.apply(this, arguments);
|
22 | }
|
23 |
|
24 | function _objectWithoutPropertiesLoose(source, excluded) {
|
25 | if (source == null) return {};
|
26 | var target = {};
|
27 | var sourceKeys = Object.keys(source);
|
28 | var key, i;
|
29 |
|
30 | for (i = 0; i < sourceKeys.length; i++) {
|
31 | key = sourceKeys[i];
|
32 | if (excluded.indexOf(key) >= 0) continue;
|
33 | target[key] = source[key];
|
34 | }
|
35 |
|
36 | return target;
|
37 | }
|
38 |
|
39 | function createCommonjsModule(fn, module) {
|
40 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
52 | Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
53 | function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
|
54 | var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
55 | var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
56 | var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
57 |
|
58 | var reactIs_production_min = {
|
59 | AsyncMode: AsyncMode,
|
60 | ConcurrentMode: ConcurrentMode,
|
61 | ContextConsumer: ContextConsumer,
|
62 | ContextProvider: ContextProvider,
|
63 | Element: Element,
|
64 | ForwardRef: ForwardRef,
|
65 | Fragment: Fragment,
|
66 | Lazy: Lazy,
|
67 | Memo: Memo,
|
68 | Portal: Portal,
|
69 | Profiler: Profiler,
|
70 | StrictMode: StrictMode,
|
71 | Suspense: Suspense,
|
72 | isAsyncMode: isAsyncMode,
|
73 | isConcurrentMode: isConcurrentMode,
|
74 | isContextConsumer: isContextConsumer,
|
75 | isContextProvider: isContextProvider,
|
76 | isElement: isElement,
|
77 | isForwardRef: isForwardRef,
|
78 | isFragment: isFragment,
|
79 | isLazy: isLazy,
|
80 | isMemo: isMemo,
|
81 | isPortal: isPortal,
|
82 | isProfiler: isProfiler,
|
83 | isStrictMode: isStrictMode,
|
84 | isSuspense: isSuspense,
|
85 | isValidElementType: isValidElementType,
|
86 | typeOf: typeOf
|
87 | };
|
88 |
|
89 | var reactIs_development = createCommonjsModule(function (module, exports) {
|
90 |
|
91 |
|
92 |
|
93 | if (process.env.NODE_ENV !== "production") {
|
94 | (function() {
|
95 |
|
96 |
|
97 |
|
98 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
99 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
100 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
101 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
102 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
103 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
104 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
105 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
106 |
|
107 |
|
108 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
109 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
110 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
111 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
112 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
113 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
114 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
115 | var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
116 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
117 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
118 | var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
119 |
|
120 | function isValidElementType(type) {
|
121 | return typeof type === 'string' || typeof type === 'function' ||
|
122 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
123 | }
|
124 |
|
125 | function typeOf(object) {
|
126 | if (typeof object === 'object' && object !== null) {
|
127 | var $$typeof = object.$$typeof;
|
128 |
|
129 | switch ($$typeof) {
|
130 | case REACT_ELEMENT_TYPE:
|
131 | var type = object.type;
|
132 |
|
133 | switch (type) {
|
134 | case REACT_ASYNC_MODE_TYPE:
|
135 | case REACT_CONCURRENT_MODE_TYPE:
|
136 | case REACT_FRAGMENT_TYPE:
|
137 | case REACT_PROFILER_TYPE:
|
138 | case REACT_STRICT_MODE_TYPE:
|
139 | case REACT_SUSPENSE_TYPE:
|
140 | return type;
|
141 |
|
142 | default:
|
143 | var $$typeofType = type && type.$$typeof;
|
144 |
|
145 | switch ($$typeofType) {
|
146 | case REACT_CONTEXT_TYPE:
|
147 | case REACT_FORWARD_REF_TYPE:
|
148 | case REACT_LAZY_TYPE:
|
149 | case REACT_MEMO_TYPE:
|
150 | case REACT_PROVIDER_TYPE:
|
151 | return $$typeofType;
|
152 |
|
153 | default:
|
154 | return $$typeof;
|
155 | }
|
156 |
|
157 | }
|
158 |
|
159 | case REACT_PORTAL_TYPE:
|
160 | return $$typeof;
|
161 | }
|
162 | }
|
163 |
|
164 | return undefined;
|
165 | }
|
166 |
|
167 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
168 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
169 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
170 | var ContextProvider = REACT_PROVIDER_TYPE;
|
171 | var Element = REACT_ELEMENT_TYPE;
|
172 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
173 | var Fragment = REACT_FRAGMENT_TYPE;
|
174 | var Lazy = REACT_LAZY_TYPE;
|
175 | var Memo = REACT_MEMO_TYPE;
|
176 | var Portal = REACT_PORTAL_TYPE;
|
177 | var Profiler = REACT_PROFILER_TYPE;
|
178 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
179 | var Suspense = REACT_SUSPENSE_TYPE;
|
180 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
181 |
|
182 | function isAsyncMode(object) {
|
183 | {
|
184 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
185 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
186 |
|
187 | console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
188 | }
|
189 | }
|
190 |
|
191 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
192 | }
|
193 | function isConcurrentMode(object) {
|
194 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
195 | }
|
196 | function isContextConsumer(object) {
|
197 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
198 | }
|
199 | function isContextProvider(object) {
|
200 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
201 | }
|
202 | function isElement(object) {
|
203 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
204 | }
|
205 | function isForwardRef(object) {
|
206 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
207 | }
|
208 | function isFragment(object) {
|
209 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
210 | }
|
211 | function isLazy(object) {
|
212 | return typeOf(object) === REACT_LAZY_TYPE;
|
213 | }
|
214 | function isMemo(object) {
|
215 | return typeOf(object) === REACT_MEMO_TYPE;
|
216 | }
|
217 | function isPortal(object) {
|
218 | return typeOf(object) === REACT_PORTAL_TYPE;
|
219 | }
|
220 | function isProfiler(object) {
|
221 | return typeOf(object) === REACT_PROFILER_TYPE;
|
222 | }
|
223 | function isStrictMode(object) {
|
224 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
225 | }
|
226 | function isSuspense(object) {
|
227 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
228 | }
|
229 |
|
230 | exports.AsyncMode = AsyncMode;
|
231 | exports.ConcurrentMode = ConcurrentMode;
|
232 | exports.ContextConsumer = ContextConsumer;
|
233 | exports.ContextProvider = ContextProvider;
|
234 | exports.Element = Element;
|
235 | exports.ForwardRef = ForwardRef;
|
236 | exports.Fragment = Fragment;
|
237 | exports.Lazy = Lazy;
|
238 | exports.Memo = Memo;
|
239 | exports.Portal = Portal;
|
240 | exports.Profiler = Profiler;
|
241 | exports.StrictMode = StrictMode;
|
242 | exports.Suspense = Suspense;
|
243 | exports.isAsyncMode = isAsyncMode;
|
244 | exports.isConcurrentMode = isConcurrentMode;
|
245 | exports.isContextConsumer = isContextConsumer;
|
246 | exports.isContextProvider = isContextProvider;
|
247 | exports.isElement = isElement;
|
248 | exports.isForwardRef = isForwardRef;
|
249 | exports.isFragment = isFragment;
|
250 | exports.isLazy = isLazy;
|
251 | exports.isMemo = isMemo;
|
252 | exports.isPortal = isPortal;
|
253 | exports.isProfiler = isProfiler;
|
254 | exports.isStrictMode = isStrictMode;
|
255 | exports.isSuspense = isSuspense;
|
256 | exports.isValidElementType = isValidElementType;
|
257 | exports.typeOf = typeOf;
|
258 | })();
|
259 | }
|
260 | });
|
261 |
|
262 | var reactIs = createCommonjsModule(function (module) {
|
263 |
|
264 | if (process.env.NODE_ENV === 'production') {
|
265 | module.exports = reactIs_production_min;
|
266 | } else {
|
267 | module.exports = reactIs_development;
|
268 | }
|
269 | });
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
278 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
279 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
280 |
|
281 | function toObject(val) {
|
282 | if (val === null || val === undefined) {
|
283 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
284 | }
|
285 |
|
286 | return Object(val);
|
287 | }
|
288 |
|
289 | function shouldUseNative() {
|
290 | try {
|
291 | if (!Object.assign) {
|
292 | return false;
|
293 | }
|
294 |
|
295 |
|
296 |
|
297 |
|
298 | var test1 = new String('abc');
|
299 | test1[5] = 'de';
|
300 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
301 | return false;
|
302 | }
|
303 |
|
304 |
|
305 | var test2 = {};
|
306 | for (var i = 0; i < 10; i++) {
|
307 | test2['_' + String.fromCharCode(i)] = i;
|
308 | }
|
309 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
310 | return test2[n];
|
311 | });
|
312 | if (order2.join('') !== '0123456789') {
|
313 | return false;
|
314 | }
|
315 |
|
316 |
|
317 | var test3 = {};
|
318 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
319 | test3[letter] = letter;
|
320 | });
|
321 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
322 | 'abcdefghijklmnopqrst') {
|
323 | return false;
|
324 | }
|
325 |
|
326 | return true;
|
327 | } catch (err) {
|
328 |
|
329 | return false;
|
330 | }
|
331 | }
|
332 |
|
333 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
334 | var from;
|
335 | var to = toObject(target);
|
336 | var symbols;
|
337 |
|
338 | for (var s = 1; s < arguments.length; s++) {
|
339 | from = Object(arguments[s]);
|
340 |
|
341 | for (var key in from) {
|
342 | if (hasOwnProperty.call(from, key)) {
|
343 | to[key] = from[key];
|
344 | }
|
345 | }
|
346 |
|
347 | if (getOwnPropertySymbols) {
|
348 | symbols = getOwnPropertySymbols(from);
|
349 | for (var i = 0; i < symbols.length; i++) {
|
350 | if (propIsEnumerable.call(from, symbols[i])) {
|
351 | to[symbols[i]] = from[symbols[i]];
|
352 | }
|
353 | }
|
354 | }
|
355 | }
|
356 |
|
357 | return to;
|
358 | };
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
368 |
|
369 | var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
370 |
|
371 | var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
372 |
|
373 | var printWarning = function() {};
|
374 |
|
375 | if (process.env.NODE_ENV !== 'production') {
|
376 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
377 | var loggedTypeFailures = {};
|
378 | var has$1 = has;
|
379 |
|
380 | printWarning = function(text) {
|
381 | var message = 'Warning: ' + text;
|
382 | if (typeof console !== 'undefined') {
|
383 | console.error(message);
|
384 | }
|
385 | try {
|
386 |
|
387 |
|
388 |
|
389 | throw new Error(message);
|
390 | } catch (x) { }
|
391 | };
|
392 | }
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
406 | if (process.env.NODE_ENV !== 'production') {
|
407 | for (var typeSpecName in typeSpecs) {
|
408 | if (has$1(typeSpecs, typeSpecName)) {
|
409 | var error;
|
410 |
|
411 |
|
412 |
|
413 | try {
|
414 |
|
415 |
|
416 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
417 | var err = Error(
|
418 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
419 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
420 | 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
421 | );
|
422 | err.name = 'Invariant Violation';
|
423 | throw err;
|
424 | }
|
425 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
426 | } catch (ex) {
|
427 | error = ex;
|
428 | }
|
429 | if (error && !(error instanceof Error)) {
|
430 | printWarning(
|
431 | (componentName || 'React class') + ': type specification of ' +
|
432 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
433 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
434 | 'You may have forgotten to pass an argument to the type checker ' +
|
435 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
436 | 'shape all require an argument).'
|
437 | );
|
438 | }
|
439 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
440 |
|
441 |
|
442 | loggedTypeFailures[error.message] = true;
|
443 |
|
444 | var stack = getStack ? getStack() : '';
|
445 |
|
446 | printWarning(
|
447 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
448 | );
|
449 | }
|
450 | }
|
451 | }
|
452 | }
|
453 | }
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 | checkPropTypes.resetWarningCache = function() {
|
461 | if (process.env.NODE_ENV !== 'production') {
|
462 | loggedTypeFailures = {};
|
463 | }
|
464 | };
|
465 |
|
466 | var checkPropTypes_1 = checkPropTypes;
|
467 |
|
468 | var printWarning$1 = function() {};
|
469 |
|
470 | if (process.env.NODE_ENV !== 'production') {
|
471 | printWarning$1 = function(text) {
|
472 | var message = 'Warning: ' + text;
|
473 | if (typeof console !== 'undefined') {
|
474 | console.error(message);
|
475 | }
|
476 | try {
|
477 |
|
478 |
|
479 |
|
480 | throw new Error(message);
|
481 | } catch (x) {}
|
482 | };
|
483 | }
|
484 |
|
485 | function emptyFunctionThatReturnsNull() {
|
486 | return null;
|
487 | }
|
488 |
|
489 | var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
490 |
|
491 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
492 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
493 |
|
494 | |
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 | function getIteratorFn(maybeIterable) {
|
509 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
510 | if (typeof iteratorFn === 'function') {
|
511 | return iteratorFn;
|
512 | }
|
513 | }
|
514 |
|
515 | |
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 | var ANONYMOUS = '<<anonymous>>';
|
563 |
|
564 |
|
565 |
|
566 | var ReactPropTypes = {
|
567 | array: createPrimitiveTypeChecker('array'),
|
568 | bigint: createPrimitiveTypeChecker('bigint'),
|
569 | bool: createPrimitiveTypeChecker('boolean'),
|
570 | func: createPrimitiveTypeChecker('function'),
|
571 | number: createPrimitiveTypeChecker('number'),
|
572 | object: createPrimitiveTypeChecker('object'),
|
573 | string: createPrimitiveTypeChecker('string'),
|
574 | symbol: createPrimitiveTypeChecker('symbol'),
|
575 |
|
576 | any: createAnyTypeChecker(),
|
577 | arrayOf: createArrayOfTypeChecker,
|
578 | element: createElementTypeChecker(),
|
579 | elementType: createElementTypeTypeChecker(),
|
580 | instanceOf: createInstanceTypeChecker,
|
581 | node: createNodeChecker(),
|
582 | objectOf: createObjectOfTypeChecker,
|
583 | oneOf: createEnumTypeChecker,
|
584 | oneOfType: createUnionTypeChecker,
|
585 | shape: createShapeTypeChecker,
|
586 | exact: createStrictShapeTypeChecker,
|
587 | };
|
588 |
|
589 | |
590 |
|
591 |
|
592 |
|
593 |
|
594 | function is(x, y) {
|
595 |
|
596 | if (x === y) {
|
597 |
|
598 |
|
599 | return x !== 0 || 1 / x === 1 / y;
|
600 | } else {
|
601 |
|
602 | return x !== x && y !== y;
|
603 | }
|
604 | }
|
605 |
|
606 |
|
607 | |
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 | function PropTypeError(message, data) {
|
615 | this.message = message;
|
616 | this.data = data && typeof data === 'object' ? data: {};
|
617 | this.stack = '';
|
618 | }
|
619 |
|
620 | PropTypeError.prototype = Error.prototype;
|
621 |
|
622 | function createChainableTypeChecker(validate) {
|
623 | if (process.env.NODE_ENV !== 'production') {
|
624 | var manualPropTypeCallCache = {};
|
625 | var manualPropTypeWarningCount = 0;
|
626 | }
|
627 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
628 | componentName = componentName || ANONYMOUS;
|
629 | propFullName = propFullName || propName;
|
630 |
|
631 | if (secret !== ReactPropTypesSecret_1) {
|
632 | if (throwOnDirectAccess) {
|
633 |
|
634 | var err = new Error(
|
635 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
636 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
637 | 'Read more at http://fb.me/use-check-prop-types'
|
638 | );
|
639 | err.name = 'Invariant Violation';
|
640 | throw err;
|
641 | } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
642 |
|
643 | var cacheKey = componentName + ':' + propName;
|
644 | if (
|
645 | !manualPropTypeCallCache[cacheKey] &&
|
646 |
|
647 | manualPropTypeWarningCount < 3
|
648 | ) {
|
649 | printWarning$1(
|
650 | 'You are manually calling a React.PropTypes validation ' +
|
651 | 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
652 | 'and will throw in the standalone `prop-types` package. ' +
|
653 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
654 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
655 | );
|
656 | manualPropTypeCallCache[cacheKey] = true;
|
657 | manualPropTypeWarningCount++;
|
658 | }
|
659 | }
|
660 | }
|
661 | if (props[propName] == null) {
|
662 | if (isRequired) {
|
663 | if (props[propName] === null) {
|
664 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
665 | }
|
666 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
667 | }
|
668 | return null;
|
669 | } else {
|
670 | return validate(props, propName, componentName, location, propFullName);
|
671 | }
|
672 | }
|
673 |
|
674 | var chainedCheckType = checkType.bind(null, false);
|
675 | chainedCheckType.isRequired = checkType.bind(null, true);
|
676 |
|
677 | return chainedCheckType;
|
678 | }
|
679 |
|
680 | function createPrimitiveTypeChecker(expectedType) {
|
681 | function validate(props, propName, componentName, location, propFullName, secret) {
|
682 | var propValue = props[propName];
|
683 | var propType = getPropType(propValue);
|
684 | if (propType !== expectedType) {
|
685 |
|
686 |
|
687 |
|
688 | var preciseType = getPreciseType(propValue);
|
689 |
|
690 | return new PropTypeError(
|
691 | 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
692 | {expectedType: expectedType}
|
693 | );
|
694 | }
|
695 | return null;
|
696 | }
|
697 | return createChainableTypeChecker(validate);
|
698 | }
|
699 |
|
700 | function createAnyTypeChecker() {
|
701 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
702 | }
|
703 |
|
704 | function createArrayOfTypeChecker(typeChecker) {
|
705 | function validate(props, propName, componentName, location, propFullName) {
|
706 | if (typeof typeChecker !== 'function') {
|
707 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
708 | }
|
709 | var propValue = props[propName];
|
710 | if (!Array.isArray(propValue)) {
|
711 | var propType = getPropType(propValue);
|
712 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
713 | }
|
714 | for (var i = 0; i < propValue.length; i++) {
|
715 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
716 | if (error instanceof Error) {
|
717 | return error;
|
718 | }
|
719 | }
|
720 | return null;
|
721 | }
|
722 | return createChainableTypeChecker(validate);
|
723 | }
|
724 |
|
725 | function createElementTypeChecker() {
|
726 | function validate(props, propName, componentName, location, propFullName) {
|
727 | var propValue = props[propName];
|
728 | if (!isValidElement(propValue)) {
|
729 | var propType = getPropType(propValue);
|
730 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
731 | }
|
732 | return null;
|
733 | }
|
734 | return createChainableTypeChecker(validate);
|
735 | }
|
736 |
|
737 | function createElementTypeTypeChecker() {
|
738 | function validate(props, propName, componentName, location, propFullName) {
|
739 | var propValue = props[propName];
|
740 | if (!reactIs.isValidElementType(propValue)) {
|
741 | var propType = getPropType(propValue);
|
742 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
743 | }
|
744 | return null;
|
745 | }
|
746 | return createChainableTypeChecker(validate);
|
747 | }
|
748 |
|
749 | function createInstanceTypeChecker(expectedClass) {
|
750 | function validate(props, propName, componentName, location, propFullName) {
|
751 | if (!(props[propName] instanceof expectedClass)) {
|
752 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
753 | var actualClassName = getClassName(props[propName]);
|
754 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
755 | }
|
756 | return null;
|
757 | }
|
758 | return createChainableTypeChecker(validate);
|
759 | }
|
760 |
|
761 | function createEnumTypeChecker(expectedValues) {
|
762 | if (!Array.isArray(expectedValues)) {
|
763 | if (process.env.NODE_ENV !== 'production') {
|
764 | if (arguments.length > 1) {
|
765 | printWarning$1(
|
766 | 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
767 | 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
768 | );
|
769 | } else {
|
770 | printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
771 | }
|
772 | }
|
773 | return emptyFunctionThatReturnsNull;
|
774 | }
|
775 |
|
776 | function validate(props, propName, componentName, location, propFullName) {
|
777 | var propValue = props[propName];
|
778 | for (var i = 0; i < expectedValues.length; i++) {
|
779 | if (is(propValue, expectedValues[i])) {
|
780 | return null;
|
781 | }
|
782 | }
|
783 |
|
784 | var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
785 | var type = getPreciseType(value);
|
786 | if (type === 'symbol') {
|
787 | return String(value);
|
788 | }
|
789 | return value;
|
790 | });
|
791 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
792 | }
|
793 | return createChainableTypeChecker(validate);
|
794 | }
|
795 |
|
796 | function createObjectOfTypeChecker(typeChecker) {
|
797 | function validate(props, propName, componentName, location, propFullName) {
|
798 | if (typeof typeChecker !== 'function') {
|
799 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
800 | }
|
801 | var propValue = props[propName];
|
802 | var propType = getPropType(propValue);
|
803 | if (propType !== 'object') {
|
804 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
805 | }
|
806 | for (var key in propValue) {
|
807 | if (has(propValue, key)) {
|
808 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
809 | if (error instanceof Error) {
|
810 | return error;
|
811 | }
|
812 | }
|
813 | }
|
814 | return null;
|
815 | }
|
816 | return createChainableTypeChecker(validate);
|
817 | }
|
818 |
|
819 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
820 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
821 | process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
822 | return emptyFunctionThatReturnsNull;
|
823 | }
|
824 |
|
825 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
826 | var checker = arrayOfTypeCheckers[i];
|
827 | if (typeof checker !== 'function') {
|
828 | printWarning$1(
|
829 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
830 | 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
831 | );
|
832 | return emptyFunctionThatReturnsNull;
|
833 | }
|
834 | }
|
835 |
|
836 | function validate(props, propName, componentName, location, propFullName) {
|
837 | var expectedTypes = [];
|
838 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
839 | var checker = arrayOfTypeCheckers[i];
|
840 | var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
|
841 | if (checkerResult == null) {
|
842 | return null;
|
843 | }
|
844 | if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
845 | expectedTypes.push(checkerResult.data.expectedType);
|
846 | }
|
847 | }
|
848 | var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
849 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
850 | }
|
851 | return createChainableTypeChecker(validate);
|
852 | }
|
853 |
|
854 | function createNodeChecker() {
|
855 | function validate(props, propName, componentName, location, propFullName) {
|
856 | if (!isNode(props[propName])) {
|
857 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
858 | }
|
859 | return null;
|
860 | }
|
861 | return createChainableTypeChecker(validate);
|
862 | }
|
863 |
|
864 | function invalidValidatorError(componentName, location, propFullName, key, type) {
|
865 | return new PropTypeError(
|
866 | (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
867 | 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
868 | );
|
869 | }
|
870 |
|
871 | function createShapeTypeChecker(shapeTypes) {
|
872 | function validate(props, propName, componentName, location, propFullName) {
|
873 | var propValue = props[propName];
|
874 | var propType = getPropType(propValue);
|
875 | if (propType !== 'object') {
|
876 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
877 | }
|
878 | for (var key in shapeTypes) {
|
879 | var checker = shapeTypes[key];
|
880 | if (typeof checker !== 'function') {
|
881 | return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
882 | }
|
883 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
884 | if (error) {
|
885 | return error;
|
886 | }
|
887 | }
|
888 | return null;
|
889 | }
|
890 | return createChainableTypeChecker(validate);
|
891 | }
|
892 |
|
893 | function createStrictShapeTypeChecker(shapeTypes) {
|
894 | function validate(props, propName, componentName, location, propFullName) {
|
895 | var propValue = props[propName];
|
896 | var propType = getPropType(propValue);
|
897 | if (propType !== 'object') {
|
898 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
899 | }
|
900 |
|
901 | var allKeys = objectAssign({}, props[propName], shapeTypes);
|
902 | for (var key in allKeys) {
|
903 | var checker = shapeTypes[key];
|
904 | if (has(shapeTypes, key) && typeof checker !== 'function') {
|
905 | return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
906 | }
|
907 | if (!checker) {
|
908 | return new PropTypeError(
|
909 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
910 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
911 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
912 | );
|
913 | }
|
914 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
915 | if (error) {
|
916 | return error;
|
917 | }
|
918 | }
|
919 | return null;
|
920 | }
|
921 |
|
922 | return createChainableTypeChecker(validate);
|
923 | }
|
924 |
|
925 | function isNode(propValue) {
|
926 | switch (typeof propValue) {
|
927 | case 'number':
|
928 | case 'string':
|
929 | case 'undefined':
|
930 | return true;
|
931 | case 'boolean':
|
932 | return !propValue;
|
933 | case 'object':
|
934 | if (Array.isArray(propValue)) {
|
935 | return propValue.every(isNode);
|
936 | }
|
937 | if (propValue === null || isValidElement(propValue)) {
|
938 | return true;
|
939 | }
|
940 |
|
941 | var iteratorFn = getIteratorFn(propValue);
|
942 | if (iteratorFn) {
|
943 | var iterator = iteratorFn.call(propValue);
|
944 | var step;
|
945 | if (iteratorFn !== propValue.entries) {
|
946 | while (!(step = iterator.next()).done) {
|
947 | if (!isNode(step.value)) {
|
948 | return false;
|
949 | }
|
950 | }
|
951 | } else {
|
952 |
|
953 | while (!(step = iterator.next()).done) {
|
954 | var entry = step.value;
|
955 | if (entry) {
|
956 | if (!isNode(entry[1])) {
|
957 | return false;
|
958 | }
|
959 | }
|
960 | }
|
961 | }
|
962 | } else {
|
963 | return false;
|
964 | }
|
965 |
|
966 | return true;
|
967 | default:
|
968 | return false;
|
969 | }
|
970 | }
|
971 |
|
972 | function isSymbol(propType, propValue) {
|
973 |
|
974 | if (propType === 'symbol') {
|
975 | return true;
|
976 | }
|
977 |
|
978 |
|
979 | if (!propValue) {
|
980 | return false;
|
981 | }
|
982 |
|
983 |
|
984 | if (propValue['@@toStringTag'] === 'Symbol') {
|
985 | return true;
|
986 | }
|
987 |
|
988 |
|
989 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
990 | return true;
|
991 | }
|
992 |
|
993 | return false;
|
994 | }
|
995 |
|
996 |
|
997 | function getPropType(propValue) {
|
998 | var propType = typeof propValue;
|
999 | if (Array.isArray(propValue)) {
|
1000 | return 'array';
|
1001 | }
|
1002 | if (propValue instanceof RegExp) {
|
1003 |
|
1004 |
|
1005 |
|
1006 | return 'object';
|
1007 | }
|
1008 | if (isSymbol(propType, propValue)) {
|
1009 | return 'symbol';
|
1010 | }
|
1011 | return propType;
|
1012 | }
|
1013 |
|
1014 |
|
1015 |
|
1016 | function getPreciseType(propValue) {
|
1017 | if (typeof propValue === 'undefined' || propValue === null) {
|
1018 | return '' + propValue;
|
1019 | }
|
1020 | var propType = getPropType(propValue);
|
1021 | if (propType === 'object') {
|
1022 | if (propValue instanceof Date) {
|
1023 | return 'date';
|
1024 | } else if (propValue instanceof RegExp) {
|
1025 | return 'regexp';
|
1026 | }
|
1027 | }
|
1028 | return propType;
|
1029 | }
|
1030 |
|
1031 |
|
1032 |
|
1033 | function getPostfixForTypeWarning(value) {
|
1034 | var type = getPreciseType(value);
|
1035 | switch (type) {
|
1036 | case 'array':
|
1037 | case 'object':
|
1038 | return 'an ' + type;
|
1039 | case 'boolean':
|
1040 | case 'date':
|
1041 | case 'regexp':
|
1042 | return 'a ' + type;
|
1043 | default:
|
1044 | return type;
|
1045 | }
|
1046 | }
|
1047 |
|
1048 |
|
1049 | function getClassName(propValue) {
|
1050 | if (!propValue.constructor || !propValue.constructor.name) {
|
1051 | return ANONYMOUS;
|
1052 | }
|
1053 | return propValue.constructor.name;
|
1054 | }
|
1055 |
|
1056 | ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
1057 | ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
1058 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1059 |
|
1060 | return ReactPropTypes;
|
1061 | };
|
1062 |
|
1063 | function emptyFunction() {}
|
1064 | function emptyFunctionWithReset() {}
|
1065 | emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
1066 |
|
1067 | var factoryWithThrowingShims = function() {
|
1068 | function shim(props, propName, componentName, location, propFullName, secret) {
|
1069 | if (secret === ReactPropTypesSecret_1) {
|
1070 |
|
1071 | return;
|
1072 | }
|
1073 | var err = new Error(
|
1074 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
1075 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
1076 | 'Read more at http://fb.me/use-check-prop-types'
|
1077 | );
|
1078 | err.name = 'Invariant Violation';
|
1079 | throw err;
|
1080 | } shim.isRequired = shim;
|
1081 | function getShim() {
|
1082 | return shim;
|
1083 | }
|
1084 |
|
1085 | var ReactPropTypes = {
|
1086 | array: shim,
|
1087 | bigint: shim,
|
1088 | bool: shim,
|
1089 | func: shim,
|
1090 | number: shim,
|
1091 | object: shim,
|
1092 | string: shim,
|
1093 | symbol: shim,
|
1094 |
|
1095 | any: shim,
|
1096 | arrayOf: getShim,
|
1097 | element: shim,
|
1098 | elementType: shim,
|
1099 | instanceOf: getShim,
|
1100 | node: shim,
|
1101 | objectOf: getShim,
|
1102 | oneOf: getShim,
|
1103 | oneOfType: getShim,
|
1104 | shape: getShim,
|
1105 | exact: getShim,
|
1106 |
|
1107 | checkPropTypes: emptyFunctionWithReset,
|
1108 | resetWarningCache: emptyFunction
|
1109 | };
|
1110 |
|
1111 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1112 |
|
1113 | return ReactPropTypes;
|
1114 | };
|
1115 |
|
1116 | var propTypes = createCommonjsModule(function (module) {
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 | if (process.env.NODE_ENV !== 'production') {
|
1125 | var ReactIs = reactIs;
|
1126 |
|
1127 |
|
1128 |
|
1129 | var throwOnDirectAccess = true;
|
1130 | module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
1131 | } else {
|
1132 |
|
1133 |
|
1134 | module.exports = factoryWithThrowingShims();
|
1135 | }
|
1136 | });
|
1137 |
|
1138 | var propTypes$1 = {
|
1139 | animationData: propTypes.object,
|
1140 | path: propTypes.string,
|
1141 | play: propTypes.bool,
|
1142 | goTo: propTypes.number,
|
1143 | speed: propTypes.number,
|
1144 | direction: propTypes.number,
|
1145 | loop: propTypes.oneOfType([propTypes.number, propTypes.bool]),
|
1146 | useSubframes: propTypes.bool,
|
1147 | segments: propTypes.oneOfType([propTypes.arrayOf(propTypes.number), propTypes.bool]),
|
1148 | rendererSettings: propTypes.object,
|
1149 | renderer: propTypes.string,
|
1150 | audioFactory: propTypes.func,
|
1151 | onComplete: propTypes.func,
|
1152 | onLoopComplete: propTypes.func,
|
1153 | onEnterFrame: propTypes.func,
|
1154 | onSegmentStart: propTypes.func
|
1155 | };
|
1156 |
|
1157 | var emptyObject = {};
|
1158 |
|
1159 | var noOp = function noOp() {};
|
1160 |
|
1161 | var makeLottiePlayer = function makeLottiePlayer(_ref) {
|
1162 | var loadAnimation = _ref.loadAnimation;
|
1163 | var Lottie = memo(forwardRef(function (params, forwardedRef) {
|
1164 | var _params$animationData = params.animationData,
|
1165 | animationData = _params$animationData === void 0 ? null : _params$animationData,
|
1166 | _params$path = params.path,
|
1167 | path = _params$path === void 0 ? null : _params$path,
|
1168 | _params$play = params.play,
|
1169 | play = _params$play === void 0 ? null : _params$play,
|
1170 | _params$speed = params.speed,
|
1171 | speed = _params$speed === void 0 ? 1 : _params$speed,
|
1172 | _params$direction = params.direction,
|
1173 | direction = _params$direction === void 0 ? 1 : _params$direction,
|
1174 | _params$segments = params.segments,
|
1175 | segmentsIn = _params$segments === void 0 ? null : _params$segments,
|
1176 | _params$goTo = params.goTo,
|
1177 | goTo = _params$goTo === void 0 ? null : _params$goTo,
|
1178 | _params$useSubframes = params.useSubframes,
|
1179 | useSubframes = _params$useSubframes === void 0 ? true : _params$useSubframes,
|
1180 | _params$renderer = params.renderer,
|
1181 | renderer = _params$renderer === void 0 ? 'svg' : _params$renderer,
|
1182 | _params$loop = params.loop,
|
1183 | loop = _params$loop === void 0 ? true : _params$loop,
|
1184 | _params$rendererSetti = params.rendererSettings,
|
1185 | rendererSettingsIn = _params$rendererSetti === void 0 ? emptyObject : _params$rendererSetti,
|
1186 | _params$audioFactory = params.audioFactory,
|
1187 | audioFactory = _params$audioFactory === void 0 ? null : _params$audioFactory,
|
1188 | _params$onLoad = params.onLoad,
|
1189 | onLoad = _params$onLoad === void 0 ? noOp : _params$onLoad,
|
1190 | _params$onComplete = params.onComplete,
|
1191 | onComplete = _params$onComplete === void 0 ? noOp : _params$onComplete,
|
1192 | _params$onLoopComplet = params.onLoopComplete,
|
1193 | onLoopComplete = _params$onLoopComplet === void 0 ? noOp : _params$onLoopComplet,
|
1194 | _params$onEnterFrame = params.onEnterFrame,
|
1195 | onEnterFrame = _params$onEnterFrame === void 0 ? noOp : _params$onEnterFrame,
|
1196 | _params$onSegmentStar = params.onSegmentStart,
|
1197 | onSegmentStart = _params$onSegmentStar === void 0 ? noOp : _params$onSegmentStar,
|
1198 | props = _objectWithoutPropertiesLoose(params, ["animationData", "path", "play", "speed", "direction", "segments", "goTo", "useSubframes", "renderer", "loop", "rendererSettings", "audioFactory", "onLoad", "onComplete", "onLoopComplete", "onEnterFrame", "onSegmentStart"]);
|
1199 |
|
1200 | var animElementRef = useRef();
|
1201 | var animRef = useRef();
|
1202 |
|
1203 | var _useState = useState(false),
|
1204 | ready = _useState[0],
|
1205 | setReady = _useState[1];
|
1206 |
|
1207 | var _useState2 = useState(segmentsIn),
|
1208 | segments = _useState2[0],
|
1209 | setSegments = _useState2[1];
|
1210 |
|
1211 | useEffect(function () {
|
1212 | if (!equal(segments, segmentsIn)) setSegments(segmentsIn);
|
1213 | }, [segmentsIn, segments]);
|
1214 |
|
1215 | var _useState3 = useState(rendererSettingsIn),
|
1216 | rendererSettings = _useState3[0],
|
1217 | setRendererSettings = _useState3[1];
|
1218 |
|
1219 | useEffect(function () {
|
1220 | if (!equal(rendererSettings, rendererSettingsIn)) setRendererSettings(rendererSettingsIn);
|
1221 | }, [rendererSettingsIn, rendererSettings]);
|
1222 | useEffect(function () {
|
1223 | return function () {
|
1224 | return animRef.current.removeEventListener('complete', onComplete);
|
1225 | };
|
1226 | }, [onComplete]);
|
1227 | useEffect(function () {
|
1228 | return function () {
|
1229 | return animRef.current.removeEventListener('loopComplete', onLoopComplete);
|
1230 | };
|
1231 | }, [onLoopComplete]);
|
1232 | useEffect(function () {
|
1233 | return function () {
|
1234 | return animRef.current.removeEventListener('enterFrame', onEnterFrame);
|
1235 | };
|
1236 | }, [onEnterFrame]);
|
1237 | useEffect(function () {
|
1238 | return function () {
|
1239 | return animRef.current.removeEventListener('segmentStart', onSegmentStart);
|
1240 | };
|
1241 | }, [onSegmentStart]);
|
1242 | useEffect(function () {
|
1243 | return function () {
|
1244 | return animRef.current.removeEventListener('DOMLoaded', onLoad);
|
1245 | };
|
1246 | }, [onLoad]);
|
1247 | var setLottieRefs = useCallback(function (newRef) {
|
1248 | animRef.current = newRef;
|
1249 | if (forwardedRef) forwardedRef.current = newRef;
|
1250 | }, []);
|
1251 | useEffect(function () {
|
1252 | function parseAnimationData() {
|
1253 | if (animationData == null || typeof animationData !== 'object') return animationData;
|
1254 |
|
1255 | if (typeof animationData["default"] === 'object') {
|
1256 | return clone(animationData["default"]);
|
1257 | }
|
1258 |
|
1259 | return clone(animationData);
|
1260 | }
|
1261 |
|
1262 | var lottie = loadAnimation({
|
1263 | animationData: parseAnimationData(),
|
1264 | path: path,
|
1265 | container: animElementRef.current,
|
1266 | renderer: renderer,
|
1267 | loop: false,
|
1268 | autoplay: false,
|
1269 | rendererSettings: rendererSettings,
|
1270 | audioFactory: audioFactory
|
1271 | });
|
1272 | setLottieRefs(lottie);
|
1273 |
|
1274 | var onDomLoaded = function onDomLoaded() {
|
1275 | return setReady(true);
|
1276 | };
|
1277 |
|
1278 | animRef.current.addEventListener('DOMLoaded', onDomLoaded);
|
1279 | return function () {
|
1280 | animRef.current.removeEventListener('DOMLoaded', onDomLoaded);
|
1281 | setReady(false);
|
1282 | animRef.current.destroy();
|
1283 | setLottieRefs(undefined);
|
1284 | };
|
1285 | }, [loop, renderer, rendererSettings, animationData, path, audioFactory, setLottieRefs]);
|
1286 | useEffect(function () {
|
1287 | animRef.current.addEventListener('DOMLoaded', onLoad);
|
1288 | }, [onLoad]);
|
1289 | useEffect(function () {
|
1290 | animRef.current.addEventListener('complete', onComplete);
|
1291 | }, [onComplete]);
|
1292 | useEffect(function () {
|
1293 | animRef.current.addEventListener('loopComplete', onLoopComplete);
|
1294 | }, [onLoopComplete]);
|
1295 | useEffect(function () {
|
1296 | animRef.current.addEventListener('enterFrame', onEnterFrame);
|
1297 | }, [onEnterFrame]);
|
1298 | useEffect(function () {
|
1299 | animRef.current.addEventListener('segmentStart', onSegmentStart);
|
1300 | }, [onSegmentStart]);
|
1301 | useEffect(function () {
|
1302 | if (!ready) return;
|
1303 | animRef.current.loop = loop;
|
1304 | }, [ready, loop]);
|
1305 | var wasPlayingSegmentsRef = useRef(false);
|
1306 | useEffect(function () {
|
1307 | if (!ready) return;
|
1308 |
|
1309 | function playReverse(lastFrame) {
|
1310 | animRef.current.goToAndPlay(lastFrame, true);
|
1311 | animRef.current.setDirection(direction);
|
1312 | }
|
1313 |
|
1314 | if (play === true) {
|
1315 | var force = true;
|
1316 |
|
1317 | if (segments) {
|
1318 | animRef.current.playSegments(segments, force);
|
1319 | wasPlayingSegmentsRef.current = true;
|
1320 |
|
1321 | if (direction === -1) {
|
1322 | var lastFrame = segments[1];
|
1323 | playReverse(lastFrame);
|
1324 | }
|
1325 | } else {
|
1326 | if (wasPlayingSegmentsRef.current) animRef.current.resetSegments(force);
|
1327 | wasPlayingSegmentsRef.current = false;
|
1328 |
|
1329 | if (direction === -1) {
|
1330 | var _lastFrame = animRef.current.getDuration(true);
|
1331 |
|
1332 | playReverse(_lastFrame);
|
1333 | } else {
|
1334 | animRef.current.play();
|
1335 | }
|
1336 | }
|
1337 | } else if (play === false) {
|
1338 | animRef.current.pause();
|
1339 | }
|
1340 | }, [play, segments, ready, direction]);
|
1341 | useEffect(function () {
|
1342 | if (!ready) return;
|
1343 | if (Number.isNaN(speed)) return;
|
1344 | animRef.current.setSpeed(speed);
|
1345 | }, [speed, ready]);
|
1346 | useEffect(function () {
|
1347 | if (!ready) return;
|
1348 | animRef.current.setDirection(direction);
|
1349 | }, [direction, ready]);
|
1350 | useEffect(function () {
|
1351 | if (!ready) return;
|
1352 | if (goTo == null) return;
|
1353 | var isFrame = true;
|
1354 | if (play) animRef.current.goToAndPlay(goTo, isFrame);else animRef.current.goToAndStop(goTo, isFrame);
|
1355 | }, [goTo, play, ready]);
|
1356 | useEffect(function () {
|
1357 | if (animRef.current.setSubframe) animRef.current.setSubframe(useSubframes);
|
1358 | }, [useSubframes]);
|
1359 | return React.createElement("div", _extends({}, props, {
|
1360 | ref: animElementRef
|
1361 | }));
|
1362 | }));
|
1363 | Lottie.propTypes = propTypes$1;
|
1364 | return Lottie;
|
1365 | };
|
1366 |
|
1367 | var LottiePlayerLight = makeLottiePlayer(lottie);
|
1368 |
|
1369 | export default LottiePlayerLight;
|
1370 |
|